package com.ken.spring.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;


@Aspect
@Component
public class LoggingAspect {

    @Before("execution(public int com.ken.spring.aop.*(int ,int ))")
    public void beforeMethod(JoinPoint joinPoint) {
        String methodName = joinPoint.getSignature().getName();

        List<Object> objs = Arrays.asList(joinPoint.getArgs());
        System.out.println("the Method " + methodName + "with" + objs);
    }
}
